package com.ruoyi.business.controller;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.business.processIou.service.DoMonnifyFinanceService;
import com.ruoyi.business.service.ILoanService;
import com.ruoyi.business.service.IPayTransService;
import com.ruoyi.business.service.QuickRepayService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wqg
 * @description
 * @date 2022/6/24
 */
@Slf4j
@RestController
@RequestMapping("/appTocustServer")
public class AppToCustServerController {

    @Autowired
    DoMonnifyFinanceService monnifyFinanceService;

    @Autowired
    ILoanService loanService;



    @RequestMapping("/doMonniflyFinance")
    @Log(title = "财务回溯处理", businessType = BusinessType.GET)
    public JSONObject doMonnifyFinance(String loanSerialNo, String accountReference) throws Exception {
        log.info("财务回溯处理:{},{}",loanSerialNo,accountReference);
        JSONObject res =  monnifyFinanceService.doMonnifyForFinance(loanSerialNo, accountReference);
        return res;
    }

    /**
     * 财务点击调用业务系统进行放款
     * @param ids
     * @throws Exception
     */
    @RequestMapping("/callInitiateTransfer")
    @Log(title = "用业务系统进行放款", businessType = BusinessType.GET)
    public JSONObject callInitiateTransfer(String ids) throws Exception {
        log.info("用业务系统进行放款:{}",ids);
        JSONObject res = new JSONObject();
        if(StringUtils.isBlank(ids)){
            res.put("status", 1);
            res.put("msg","请选择数据");
            return res;
        }
        res = loanService.callInitiateTransfer(ids);
        return res;
    }


}
